Process Rate Estimator

A modeling side-hustle for the ETH group sustainable agroecosystems

Author

Damian Oswald

Published

September 23, 2023

1 Introduction

Denitrification is the natural process by which nitrate (NO3-) in the soil are converted by bacteria into nitrous oxide (N2O) or pure nitrigen (N2). The latter is called total denitrification — the full process described in Equation 1 takes place.

\[ \ce{NO3^- ->[\text{Nitrate}][\text{reductase}] NO2^- ->[\text{Nitrite}][\text{reductase}] NO ->[\text{Nitrite oxide}][\text{reductase}] N2O^- ->[\text{Nitrous oxide}][\text{reductase}] N2} \tag{1}\]

Denitrification occurs in conditions where oxygen is limited, such as waterlogged soils. It is part of the nitrogen cycle, where nitrogen is circulated between the atmosphere, organisms and the earth.

2 Formal model description

2.1 Model parameters

Table 1: Overview of the parameters used in the model.
Symbol Code Name Value Unit
\(BD\) BD Bulk density (mass of the many particles of the material divided by the bulk volume) \(1.686\) g cm-3
\(\theta_w\) theta_w Soil volumetric water content
\(\theta_a\) theta_a Air-filled porosity \(1-\frac{\theta_w}{\theta_t}\)
\(\theta_t\) theta_t Total soil porosity \(1-\frac{BD}{2.65}\)
\(\text T\) temperature Soil temperature \(298\) K
\(D_{\text{s}}\) D_s Gas diffusion coefficient Equation 3 m2s-1
\(D_{\text{fw}}\) D_fw Diffusivity of N2O in water Equation 5
\(D_{\text{fa}}\) D_fa Diffusivity of N2O in air Equation 6
\(D_{\text{fa,NTP}}\) Free air diffusion coefficient under standard conditions Equation 6
\(n\) n Empirical parameter (1) 1.81
\(H\) H Dimensionless Henry’s solubility constant Equation 4
\(\rho\) rho Gas density of N2O \(1.26 \times 10^6\) mg m-3

The diffusion fluxes between soil increments are described by Frick’s law (Equation 2).

\[F_{\text{calc}} = \frac{dC}{dZ} D_{\text s} \rho \tag{2}\]

Here, \(D_s\) is the gas diffusion coefficient, \(\rho\) is the gas density of N2O, and \(\frac{dC}{dZ}\) is the N2O concentration gradient from lower to upper depth. The fluxes are calculated based on N2O concentration gradients between 105-135 cm, 75-105 cm, 45-75 cm, 15-45 cm, and 0-15 cm depth layers, and ambient air above the soil surface.

\(\theta_w\) is the soil volumetric water content, \(\theta_a\) the air-filled porosity, and \(\theta_T\) is the total soil porosity.

The gas diffusion coefficient \(D_{\text s}\) was calculated according Equation 3 as established by Millington and Quirk in 1961 (2).

\[D_{\text s} = \left( \frac{\theta_w^{\frac{10}{3}} + D_{\text fw}}{H} + \theta_a^{\frac{10}{3}} \times D_{\text fa} \right) \times \theta_T^{-2} \tag{3}\]

Here, \(H\) represents a dimensionless form of Henry’s solubility constant (\(H'\)) for N2O in water at a given temperature. The constant \(H\) for N2O is calculated as follows:

\[H = \frac{8.5470 \times 10^5 \times \exp \frac{-2284}{\text T}}{\text R \times \text T} \tag{4}\]

Here, \(\text R\) is the gas constant, and \(\text T\) is the temperature (\(\text T = 298 \; \text K\)).

\(D_{\text{fw}}\) was calculated according to Equation 5 as documented by Versteeg and Van Swaaij (1988) (3).

\[D_{\text{fw}} = 5.07 \times 10^{-6} \times \exp \frac{-2371}{\text T} \tag{5}\]

\[D_{\text{fa}} = D_{\text{fa, NTP}} \times \left( \frac{\text T}{273.15} \right)^n \times \left( \frac{101'325}{\text P} \right) \tag{6}\]

2.2 Smoothing curves

The N2O concentration, site preference as well as \(\delta\)18O are estimated as a function of time for every depth and every column, separately. To achieve this function approximation, Kernel Regression as implemented in npreg is used (4). Besides choosing a Kernel, the model only requires a single hyperparameter, i.e. the bandwidth (bws), which facilitates the hyperparameter tuning.

Figure 1: Animated explanation on two examplary subsets of the data. On the left, there is a very high sinal to noise ratio, thus the optimal bandwith hyperparameter will be smaller than on the right.

The bandwidth hyperparameter is individually tuned using 3-fold 10 times repeated cross-validation for every combination of column and depth and variable1, respectively.

Table 2: List of all the best working hyperparameters (bandwidth) for every combination of depth, column for the gN2ONha variable. The search range was \([5,100]\).
1 2 3 4 5 6 7 8 9 10 11 12
7.5 100.0 13.3 5.32 83.20 100.0 94.10 94.10 5.65 9.80 21.70 57.70 100.00
30 65.2 83.2 6.39 8.15 65.2 7.67 83.20 78.30 14.10 94.10 6.01 7.67
60 18.1 18.1 5.65 6.79 78.3 24.50 21.70 17.00 6.79 6.79 5.65 6.39
90 18.1 11.1 8.67 5.32 14.1 29.40 15.00 5.00 10.40 45.20 7.67 6.01
120 17.0 10.4 5.00 5.00 18.1 11.10 8.15 10.40 5.65 6.79 9.21 6.39
Table 3: List of all the best working hyperparameters (bandwidth) for every combination of depth, column for the SP variable. The search range was \([5,100]\).
1 2 3 4 5 6 7 8 9 10 11 12
7.5 8.15 57.7 21.7 33.3 100.0 83.2 37.60 27.7 18.10 51.0 54.3 65.2
30 11.10 33.3 17.0 23.1 100.0 40.0 26.10 51.0 83.20 26.1 78.3 78.3
60 7.67 73.7 35.4 100.0 69.3 11.8 5.65 9.8 94.10 51.0 11.8 26.1
90 35.40 94.1 29.4 100.0 88.5 100.0 78.30 73.7 5.32 40.0 24.5 11.1
120 8.67 15.0 31.3 27.7 88.5 54.3 7.67 35.4 73.70 37.6 12.5 13.3
Table 4: List of all the best working hyperparameters (bandwidth) for every combination of depth, column for the d18O variable. The search range was \([5,100]\).
1 2 3 4 5 6 7 8 9 10 11 12
7.5 61.30 100.00 23.1 31.3 83.2 37.6 65.20 35.4 61.30 88.5 88.50 100.0
30 6.79 9.21 17.0 29.4 51.0 61.3 12.50 18.1 8.67 100.0 5.65 17.0
60 18.10 27.70 42.5 13.3 17.0 23.1 40.00 78.3 19.20 12.5 5.65 23.1
90 24.50 12.50 35.4 23.1 16.0 100.0 37.60 19.2 5.00 16.0 20.40 20.4
120 7.67 8.15 45.2 24.5 18.1 83.2 7.67 19.2 31.30 83.2 19.20 26.1

Figure 2: Visualization of the optimal hyperparameter size by depth, column and variable.

2.3 State function set

Still to do.

3 The data

The study uses data collected from a mesocosm experiment – i.e. an outdoor experiment that examines the natural environment under controlled conditions. The experiment was set up as a randomized complete block design, with 4 varieties and 3 replicates, using 12 non-weighted lysimeters. A non-weighted lysimeter is a device to measure the amount of water that drains through soil, and to determine the types and amounts of dissolved nutrients or contaminants in the water. Each lysimeter had five sampling ports with soil moisture probes and custom-built pore gas sample, at depths of 7.5, 30, 60, 90 and 120 cm below soil surface.

\[4 \times 3 \times 5 \times 161 = 9660 \tag{7}\]

Equation 7 shows how many observations we should expect to have. In reality, some observations are missing.

Code Name Description
day_column_depth Combination
date_R Weird date Year + DOY
column Column
depth Measurement depth
increment ?
variety Wheat variety
moisture Soil moisture
concNO3N NO3-N concentration Nitrate nitrogen concentration ([NO3] = [NO3-N] * 4.43).
NO3N_ha
corrected.N2O
corrected.CO2
mgN2ONm3
gN2ONha
gCO2Cha
CN
d15Nbulk
d15Nalpha
d15Nbeta
SP Site preference
d18O Ratio of stable isotopes oxygen-18 (18O) and oxygen-16 (16O).

References

1.
Massman, W. A review of the molecular diffusivities of H2O, CO2, CH4, CO, O3, SO2, NH3, N2O, NO, and NO2 in air, O2 and N2 near STP. Atmospheric environment 32, 1111–1127 (1998).
2.
Millington, R. & Quirk, J. Permeability of porous solids. Transactions of the Faraday Society 57, 1200–1207 (1961).
3.
Versteeg, G. F. & Van Swaaij, W. P. Solubility and diffusivity of acid gases (carbon dioxide, nitrous oxide) in aqueous alkanolamine solutions. Journal of Chemical & Engineering Data 33, 29–34 (1988).
4.
Hayfield, T. & Racine, J. S. Nonparametric econometrics: The np package. Journal of Statistical Software 27, 1–32 (2008).

Footnotes

  1. I.e. the three variables N2O concentration, site preference and \(\delta\)18O.↩︎